﻿using System;
using System.Collections.Generic;
using Tao.FreeType;
using AvantGameMachine.DataManagement;
using AvantGameMachine.FileSystem;

namespace AvantGameMachine.Graphics
{
    public class TextRenderingManager
    {
        private IntPtr library;
        private IntPtr face;

        internal TextRenderingManager()
        {
        }

        internal void Init()
        {
            FT.FT_Init_FreeType(out library);
        }

        public Font GetNewFont(Address _address,uint _sz)
        {
            FileInformation fi = (FileInformation)AGMPlatform.FSManager.GetFile(_address);
            byte[] bytes = fi.GetBytes();
            FT.FT_New_Memory_Face(library, bytes, bytes.Length, 0, out face);
            Font ft = new Font(face,_sz);
            return ft;
        }
    }
}
